<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <ul>
      <li>第1个li</li>
      <li>第2个li</li>
      <li>第3个li</li>
      <li>第4个li</li>
    </ul>
    <script>
      var ul = document.querySelector("ul");
      var lis = ul.childNodes; // w3c推荐的
      var li = ul.children;
      for (var i = 0; i < li.length; i++) {
        console.log(li[i].innerHTML);
      }
    </script>
  </body>
</html>
